export default function promiseFunction(func: any, notErrorLikely: boolean=false) {
    return function(){
        return new Promise(resove=>{
            func(...arguments, function (err:any, ...args: any[]){
                if(!notErrorLikely) {
                    if(err) {
                        throw err
                    }
                    resove(...args)
                }
                else {
                    resove(...arguments)
                }
            })
        })
    }
}